package com.mengniu.commerce.sync.api;

import com.mengniu.commerce.common.core.constant.SecurityConstants;
import com.mengniu.commerce.common.core.constant.ServiceNameConstants;
import com.mengniu.commerce.sync.api.base.MnResult;
import com.mengniu.commerce.sync.api.domain.CreateItemModel;
import com.mengniu.commerce.sync.api.domain.ModifyItemModel;
import com.mengniu.commerce.sync.api.factory.RemoteItemFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

import java.util.List;


/**
 * 数据同步 --商品服务
 *
 * @author yz_sm
 */
@FeignClient(contextId = "RemoteItemService", value = ServiceNameConstants.DATA_SYNC_SERVICE, fallbackFactory = RemoteItemFallbackFactory.class)
public interface RemoteItemService
{
    /**
     * 商品创建
     *
     * @param  list 商品创建集合
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping(value = "/item/createItem")
    MnResult createItem(@RequestBody List<CreateItemModel> list, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 商品修改
     *
     * @param  modifyItemModel 商品创建集合
     * @param source 请求来源
     * @return 结果
     */
    @PostMapping(value = "/item/modifyItem")
    MnResult modify(@RequestBody ModifyItemModel modifyItemModel, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
